﻿<phone:PhoneApplicationPage
    x:Class="ProtoType.FormsList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696" 
    shell:SystemTray.IsVisible="True">

    <!--Data context is set to sample data above and LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="24,24,0,12"  >
            <TextBlock x:Name="ApplicationTitle" Text="PROTO TYPE" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="ListTitle" Text="forms list" Margin="5,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel contains ListBox and ListBox ItemTemplate. Place additional content here-->
        <ListBox x:Name="MainListBox" ItemsSource="{Binding Items}" Height="540" Width="460" HorizontalAlignment="Left" Margin="15,150,0,0"
                 MouseLeftButtonDown="lbNames_MouseLeftButtonDown"  MouseLeftButtonUp="lbNames_MouseLeftButtonUp"  VerticalAlignment="Top">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Canvas Name="listcanvas" Width="450" Height="50"  Margin="0,15,0,0" >
                        <StackPanel Orientation="Vertical" Width="300">
                            <TextBlock Text="{Binding Name}" Style="{StaticResource PhoneTextTitle2Style}"/>
                            <TextBlock Text="{Binding Description}" Style="{StaticResource PhoneTextSmallStyle}" Opacity="0.8"/>
                        </StackPanel>
                        <Button Name="LnkGoToApp" Margin="300,0,0,0" 
                                Click="butGoToApp_Click" Tag="{Binding Id}"
                                 BorderBrush="{x:Null}"  BorderThickness="0">
                            <Image Source="Images/dataicon.png"></Image>
                        </Button>
                        <Button Name="LnkDesign" Margin="380,0,0,0" Click="butDesign_Click" Tag="{Binding Id}" 
                                BorderBrush="{x:Null}" BorderThickness="0">
                            <Image Source="Images/designicon.png"></Image>
                        </Button>
                    </Canvas>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Popup  x:Name="DeleteContextMenu"  Height="500"  Width="400">
            <!-- This is a ListBox as an ItemTemplate for the Popup -->
            <ListBox x:Name="lbDeleteContextMenu" Background="White" SelectionChanged="DeleteContextMenu_Selectionchanged">
                <ListBoxItem  Content="Delete Form"  
                 Foreground="Red" FontSize="25" FontWeight="Bold"/>
            </ListBox>
        </Popup>
    </Grid>


    <!-- ApplicationBar Icons -->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_new" IconUri="Images/appbar.new.rest.png" Text="new" Click="newButton_Click"></shell:ApplicationBarIconButton>
            <shell:ApplicationBarIconButton x:Name="appbar_loadlocaldata" IconUri="Images/loadfromCloud.png" Text="load local data" Click="appbar_loadlocaldata_Click"  ></shell:ApplicationBarIconButton>
            <shell:ApplicationBarIconButton x:Name="appbar_savetocloud" IconUri="Images/appbar.save.rest.png" Text="save cloud" Click="appbar_savetocloud_Click" ></shell:ApplicationBarIconButton>
            <shell:ApplicationBarIconButton x:Name="appbar_loadformcloud" IconUri="Images/loadfromCloud.png" Text="load cloud" Click="appbar_loadformcloud_Click" ></shell:ApplicationBarIconButton>
            <!--<shell:ApplicationBarIconButton x:Name="appbar_settings" IconUri="Images/appbar.feature.settings.rest.png" Text="settings" Click="settingsButton_Click"></shell:ApplicationBarIconButton>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
